package zan.game.panel;

import static org.lwjgl.opengl.GL11.GL_MODELVIEW;
import static org.lwjgl.opengl.GL11.GL_PROJECTION;
import static org.lwjgl.opengl.GL11.glLoadIdentity;
import static org.lwjgl.opengl.GL11.glMatrixMode;
import static org.lwjgl.opengl.GL11.glOrtho;
import zan.game.GameCore;
import zan.game.sound.SoundManager;
import zan.game.sprite.SpriteManager;
import zan.game.sprite.TextManager;

public class TestPanel implements IPanel {
	
	private boolean initialized;
	
	public TestPanel() {}
	
	public boolean isInitialized() {return initialized;}
	
	public void init() {
		SoundManager.playBGM("testmusic");
		initialized = true;
	}
	public void destroy() {initialized = false;}
	
	public void update() {}
	
	public void render() {
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(0f, GameCore.GAME_HEIGHT*GameCore.getScreenRatio(), 0f, GameCore.GAME_HEIGHT, -1f, 1f);
		glMatrixMode(GL_MODELVIEW);
		
		SpriteManager.getSprite("testsprite").render(GameCore.GAME_HEIGHT*GameCore.getScreenRatio()/2f, GameCore.GAME_HEIGHT/2f, 256f);
		TextManager.renderText("FPS: " + GameCore.getFPS(), "defont", 5f, GameCore.GAME_HEIGHT - 5f, 10f, 6);
	}
	
}
